/*
 * EDAS2 - TetraTech, Inc.
 *
 * Distributable under GPL license.
 * See terms of license at gnu.org.
 */
package com.tetratech.edas2.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * Organization generated by hbm2java
 */
@Entity
@Table(name = "ED_ORGANIZATION")
public class Organization extends AttributableUpdateEntity
		implements
			java.io.Serializable {

	private Long uid;
	private String id;
	private String name;
	private String description;
	private Set<Citation> citations = new HashSet<Citation>(0);
	private Set<ResultFrequencyClass> resultFrequencyClasses = new HashSet<ResultFrequencyClass>(
			0);
	private Set<Result> results = new HashSet<Result>(0);
	private Set<AnalyticalMethod> analyticalMethods = new HashSet<AnalyticalMethod>(
			0);
	private Set<Activity> activities = new HashSet<Activity>(0);
	private Set<MonitoringLocation> monitoringLocations = new HashSet<MonitoringLocation>(
			0);

	public Organization() {
	}

	public Organization(Long uid, String id, String name) {
		this.uid = uid;
		this.id = id;
		this.name = name;
	}

	@Id
	@Column(name = "ORG_UID", unique = true, nullable = false, precision = 20, scale = 0)
	@GeneratedValue(generator = "OrganizationSequence")
	@SequenceGenerator(name = "OrganizationSequence", sequenceName = "ORG_SEQ", allocationSize = 1)
	//@NotNull
	public Long getUid() {
		return this.uid;
	}

	public void setUid(Long uid) {
		this.uid = uid;
	}

	@Column(name = "ORG_ID", nullable = false, length = 30)
	@NotNull
	@Length(max = 30)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "ORG_NAME", nullable = false, length = 120)
	@NotNull
	@Length(max = 120)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "ORG_DESC", length = 500)
	@Length(max = 500)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "organization")
	public Set<Citation> getCitations() {
		return this.citations;
	}

	public void setCitations(Set<Citation> citations) {
		this.citations = citations;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "organization")
	public Set<ResultFrequencyClass> getResultFrequencyClasses() {
		return this.resultFrequencyClasses;
	}

	public void setResultFrequencyClasses(
			Set<ResultFrequencyClass> resultFrequencyClasses) {
		this.resultFrequencyClasses = resultFrequencyClasses;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "organization")
	public Set<Result> getResults() {
		return this.results;
	}

	public void setResults(Set<Result> results) {
		this.results = results;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "organization")
	public Set<AnalyticalMethod> getAnalyticalMethods() {
		return this.analyticalMethods;
	}

	public void setAnalyticalMethods(Set<AnalyticalMethod> analyticalMethods) {
		this.analyticalMethods = analyticalMethods;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "organization")
	public Set<Activity> getActivities() {
		return this.activities;
	}

	public void setActivities(Set<Activity> activities) {
		this.activities = activities;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "organization")
	public Set<MonitoringLocation> getMonitoringLocations() {
		return this.monitoringLocations;
	}

	public void setMonitoringLocations(
			Set<MonitoringLocation> monitoringLocations) {
		this.monitoringLocations = monitoringLocations;
	}

}
